<template>
  <div>
    <button @click="show =!show">显示/隐藏</button>
    <!-- 这里的transition标签的name属性值必须与style标签的动画名称一致 -->
    <transition name="hello" appear>
        <h1 v-show="show" >你好啊！</h1>
    </transition>
  </div>
</template>

<script>
export default {
    name: 'Test',
    data() {
        return {
            show: true
        }
    }
}
</script>

<style scoped>
    h1 {
        background-color: orange;
    }
    .hello-enter-active {
        animation: fadeIn 1s linear ;
    }

    .hello-leave-active {
        animation: fadeIn 1s reverse;
    }
    .v-enter-active {
        animation: fadeIn 1s linear ;
    }

    .v-leave-active {
        animation: fadeIn 1s reverse;
    }
    @keyframes fadeIn {
        from {
            transform: translateX(-100%);
        }
        to {
            transform: translateX(0px);
        }
    }
    
</style>